import request from '@/utils/request'

export const objectsUploadService = (formData) => {
  return request.post('/op/objects/upload', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

export const objectsCreateFolderService = (folderPath) => {
  return request.post('/op/objects/folder', folderPath, { headers: { 'Content-Type': 'text/plain' } })
}

export const objectsDeleteService = (bucketName, ids) => {
  return request.delete(`/op/objects/${bucketName}/${ids}`)
}


export const objectsGetListService = (lastId, parentPath) => {
  return request.get('/op/objects', {
    params: { lastId, parentPath },
  })
}

// 下载object
export const objectsDownloadService = (objectPath) => {
  return request.get('/op/objects/download', {
    params: { objectPath },
    responseType: 'blob',
  })
}
